import http from '../../util/request.js';
import alert from '../../util/alert.js';
Page({
  data:{
    article:[],
    page: 0,
    size: 8,
    hasMore:true
  },
  loadMore:function(e) {
    var that = this;
    var page = that.data.page;
    http.get('api', {
      r: 'home.Articlelist',
      page: page+1,
      size: that.data.size
    }).then(data => {
      if (data == '') {
        alert('没有了', '');
      }
      this.setData({
        page: page + 1,
        article: that.data.article.concat(data)
      });
    });
  },
  // scroll:function(e){
  //   console.log(e);
  // },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    http.get('api', {
       r: 'home.Articlelist',
       page: this.data.page,
       size: this.data.size
       }).then(data => {
      this.setData({ article: data });
    });
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  getScanning: function () {
    app.getScanning()
  }
})
